package com.wcl.nullmusic.mode.db;

import android.content.Context;
import android.database.DatabaseErrorHandler;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import com.wcl.nullmusic.utils.Contant;

/**
 * Created by dllo on 16/1/15.
 */
public class NullMusicDBHelper extends SQLiteOpenHelper {
    public static final String recommend_recyclerview_list_list_sql = "create table " + Contant.RECOMMEND_RECYCLERVIEW_LIST_LIST_TABLENAME
            + " ( _id integer primary key autoincrement, title text,subtitle text,key text,nickname text," +
            "coverPath text,intro text,coverSmall text,coverMiddle text,playsCounts integer,tracksCounts integer," +
            "albumId integer,position text)";
    public static final String recommend_recyclerview_list_sql = "create table " + Contant.RECOMMEND_RECYCLERVIEW_LIST_TABLENAME
            + " ( _id integer primary key autoincrement, moduleType integer,title text,hasMore integer,position text)";
    public static final String recommend_viewpager_sql = "create table " + Contant.RECOMMEND_VIEWPAGER_TABLENAME
            + " ( _id integer primary key autoincrement," +
            "shortTitle text,longTitle text,pic text,trackId integer,type integer,albumId integer,specialId integer)";
    public static final String songmenu_recyclerview_sql = "create table " + Contant.SONGMENU_RECYCLERVIEW_TABLENAME
            + " ( _id integer primary key autoincrement, title text,subtitle text,key text,nickname text," +
            "coverPath text,intro text,coverSmall text,coverMiddle text,playsCounts integer,tracksCounts integer," +
            "albumId integer,position text)";
    public static final String anthology_album_sql = "create table " + Contant.ANTHOLOGY_ALBUM_TABLENAME
            + " ( _id integer primary key autoincrement, title text,coverLarge text,intro text,nickname text,tags text)";
    public static final String anthology_track_sql = "create table " + Contant.ANTHOLOGY_TRACK_TABLENAME
            + " ( _id integer primary key autoincrement, totalCount integer,position text)";
    public static final String anthology_track_list_sql = "create table " + Contant.ANTHOLOGY_TRACK_LIST_TABLENAME
            + " ( _id integer primary key autoincrement, trackId integer,duration real,playUrl32 text,playUrl64 text," +
            "downloadUrl text,title text,coverLarge text,coverSmall text,comments integer,playtimes integer,favoritesCounts integer," +
            "playsCounts integer,commentsCounts integer,nickname text,position text)";
    public static final String songdetail_info_sql = "create table " + Contant.SONGDETAIL_INFO_TABLENAME
            + " ( _id integer primary key autoincrement, contentType integer,coverPathBig text,intro text,title text," +
            "nickname text,smallLogo text,personalSignature text,position text)";
    public static final String songdetail_recyclerview_sql = "create table " + Contant.SONGDETAIL_RECYCLERVIEW_TABLENAME
            + " ( _id integer primary key autoincrement, trackId integer,duration real,playUrl32 text,playUrl64 text," +
            "downloadUrl text,title text,coverLarge text,coverSmall text,comments integer,playtimes integer,favoritesCounts integer," +
            "playsCounts integer,commentsCounts integer,nickname text,position text)";


    public NullMusicDBHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, factory, version);
    }

    public NullMusicDBHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version, DatabaseErrorHandler errorHandler) {
        super(context, name, factory, version, errorHandler);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {

        db.execSQL(recommend_recyclerview_list_list_sql);
        db.execSQL(recommend_recyclerview_list_sql);
        db.execSQL(recommend_viewpager_sql);
        db.execSQL(songmenu_recyclerview_sql);
//        db.execSQL(anthology_album_sql);
//        db.execSQL(anthology_track_sql);
//        db.execSQL(anthology_track_list_sql);
//        db.execSQL(songdetail_info_sql);
//        db.execSQL(songdetail_recyclerview_sql);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
